]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Handle touchpad gestures on actor
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Dec 2025 13:33:38 +0000 (14:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Dec 2025 13:35:55 +0000 (14:35 +0100)
Touchscreen gestures and scrolling are already handled by events
on the associated actor rather than the stage. There's no good
reason to not do the same for touchpad gestures as well.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8850
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3997>

js/ui/swipeTracker.js

index 7a0703c26416e07f234b2638d268d61c3414eedf..c21d51e658b229a7a8f0462958e489d5c1d30233 100644 (file)
@@ -103,7 +103,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
         'end':    {param_types: [GObject.TYPE_UINT, GObject.TYPE_DOUBLE]},
     },
 }, class TouchpadSwipeGesture extends GObject.Object {
-    _init(allowedModes) {
+    _init(actor, allowedModes) {
         super._init();
         this._allowedModes = allowedModes;
         this._state = TouchpadState.NONE;
@@ -113,8 +113,8 @@ const TouchpadSwipeGesture = GObject.registerClass({
             schema_id: 'org.gnome.desktop.peripherals.touchpad',
         });
 
-        global.stage.connectObject(
-            'captured-event::touchpad', this._handleEvent.bind(this), this);
+        actor.connectObject(
+            'event::touchpad', this._handleEvent.bind(this), this);
     }
 
     _handleEvent(actor, event) {
@@ -405,7 +405,7 @@ export const SwipeTracker = GObject.registerClass({
             null);
         actor.add_action_full(params.name, params.phase, this._panGesture);
 
-        this._touchpadGesture = new TouchpadSwipeGesture(allowedModes);
+        this._touchpadGesture = new TouchpadSwipeGesture(actor, allowedModes);
         this._touchpadGesture.connect('begin', this._beginTouchpadGesture.bind(this));
         this._touchpadGesture.connect('update', this._updateTouchpadGesture.bind(this));
         this._touchpadGesture.connect('end', this._endTouchpadGesture.bind(this));